#include<bits/stdc++.h>
#define int long long
#define endl '\n'
#define debug(x) cerr<<#x<<':'<<x<<endl
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
const int N=2e5+5;
int n;
int a[N],h[N];
int p[N];
bool duel(int &A,int &H,int i){
    int x=(h[i]+A-1)/A;
    int y=(H+a[i]-1)/a[i];
    if(x-y>1) return 0;
    A=max(A,a[i]);
    H-=(x-1)*a[i];
    return 1;
}

bool check(int x){
    int A=a[0],H=x;
    if(n<=10){
        for(int i=1;i<=n;i++) p[i]=i;
        do{
            A=a[0],H=x;
            int f=1;
            for(int i=1;i<=n;i++){
                if(!duel(A,H,p[i])||H<0){
                    f=0;
                    break;
                }
            }
            if(f) return 1;
        }while(next_permutation(p+1,p+n+1));
    }
    for(int i=1;i<=n;i++) if(!duel(A,H,i)||H<0) return 0;
    return 1;
}
signed main(){
	freopen("xinyue.in","r",stdin);
	freopen("xinyue.out","w",stdout);
    cin>>n>>a[0];
    for(int i=1;i<=n;i++) cin>>a[i]>>h[i];
    int l=0,r=1e18,res=-1;
    while(l<=r){
        int mid=(l+r)>>1;
        if(check(mid)) res=mid,r=mid-1;
        else l=mid+1;
    }cout<<res;
    return 0;
}